
clear all
set more off
*-----------------------------------------------------------------------------------------
*globals
*INSERT YOUR PATH HERE TO SHP_VOX_prep folder
global path ""

global wd "$path/SHP"
global replica "$path/SHP/Documentation/replications"
cd $wd

****************************************
**** File 02 - VARIABLE SELECTION ******
****************************************
****************************************

*install commands if necessary
*ssc install isvar
*ssc install fre

*-----------------------------------------------------------------------------------------
* ---------- DATASET CREATION ------------------------------------------------------------
* CREATION OF DATASETS USING SHP-HOUSEHOLD-FILES 1999-2017 

*Note: SHP raw datasets are labelled with the *year* they were collected (1999-2017)
* SHP *Waves* on the other hand, run from 1 to 19, with the first wave being collected
*in 1999 (W1) and the last one in 2017 (W19)

foreach j in 99 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 {
use $wd/data/shp`j'_h_user, clear
*household id to string to prevent merge errors
tostring idhous`j', gen(stridhouse)
drop idhous`j'
rename stridhouse idhouse
*some variables are only available in some waves

isvar idhouse i`j'htyn  h`j'h12 h`j'i30 h`j'h01 h`j'h38 h`j'i51  h`j'i55 h`j'i56 hdate`j' h`j'h29 nbpers`j' weih`j'tp wh`j't1p wh`j't1s wh`j'csp wh`j'css wh13tp weih`j'ts wh13ts 


*create missing values for all variables not available in a given wave
foreach v in `r(badlist)' { 
  gen `v' = . 
 } 
if `j'==99{
gen shpwave=1
}
if `j'!=99{
gen shpwave= `j' + 2
}
*keep only variables of interest
keep idhouse i`j'htyn  h`j'h12 h`j'i30 h`j'h01 h`j'h38 h`j'i51  h`j'i55 h`j'i56 hdate`j' shpwave h`j'h29 nbpers`j' weih`j'tp weih`j'ts wh`j't1p wh`j't1s wh`j'csp wh`j'css wh13tp wh`j't1s wh13ts 

*assign missings to wht1s/wht1p weight for wave 13, as we only want the wh13ts/wh13tp weight which has less missings

if `j'==13{
replace wh`j't1p=.
replace wh`j't1s=.
}

rename h`j'h12 satis_acco
label var satis_acco "Satisfaction with accommodation"
rename h`j'i30 satis_hhfin
label var satis_hhfin "Satisfaction with financial situation of HH"
rename h`j'h01 livingstandard
label var livingstandard "Improvement or deterioration of standard of living"
label define livingstandard 0 "greatly deteriorated " 10 "greatly improved", replace
rename h`j'h38 housingexp
label var housingexp "Assessment of expenses connected with accommodation"
rename h`j'i51 finsit
label var finsit "Financial situation manageable"
rename h`j'i55 hhinc_past
label var hhinc_past "HH-income: Evolution from last to this year"
rename h`j'i56 hhinc_future
label var hhinc_future "HH-income: Evolution from this to next year"
rename hdate`j' intdate

*DEMOGRAPHICS
rename i`j'htyn hhinc_net
label var hhinc_net "Yearly household income, net"

*FILTER VARIABLES
rename h`j'h29 acco_tenant_owner

*WEIGHTS
*population weights
*rename yearly vars to same varname
rename weih`j'tp weihxxtp
rename wh`j't1p whxxt1p
rename wh`j'csp whxxcsp
rename nbpers`j' nbpers
label var nbpers "Number of persons in household"

*sample weights
*rename yearly vars to same varname
rename weih`j'ts weihxxts
rename wh`j't1s whxxt1s
rename wh`j'css whxxcss
*CREATE A SINGLE WEIGHT OUT OF DIFFERENT SAMPLE/POPULATION WEIGHTS
*HOUSEHOLD WEIGHTS
gen weight_h_pop=max(weihxxtp ,whxxt1p,wh13tp,whxxcsp)
replace weight_h_pop = . 	if weight_h_pop<0
label var weight_h_pop "Weights expanded to the resident Swiss population of current year (SHP_I_II_III)"

*sample weights
gen weight_h_sample=max(weihxxts, whxxt1s, wh13ts, whxxcss)
replace weight_h_sample = . 	if weight_h_sample<0
label var weight_h_sample "Weights expanded to sample size (SHP_I_II_III)"

/* in case you wish to make (weighted) analyses on the household level with this file, 
you should divide the household weight by the number of household members. 
Further information is available in the user guide. */

gen wh_pop_cor=weight_h_pop/nbpers
label var wh_pop_cor "weight_h_pop/number of persons in hh"
gen wh_sample_cor=weight_h_sample/nbpers
label var wh_sample_cor "weight_h_sample/number of persons in hh"

gen year = year(intdate)
*GET RID OF MISSING YEARS
if `j'==99{
replace year =1999 if year==.
}
 else {
replace year = 2000 + `j' if year==.
}
save $wd/workingfiles/household/temph`j', replace

}

*---------------------------------------------------------------------------------------------

* CREATION OF DATASETS USING SHP-INDIVIDUAL-FILES 1999-2017

foreach j in 99 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17  {
use $wd/data/shp`j'_p_user, clear
*convert identifiers to strings
tostring idpers, gen(stridpers)
drop idpers
rename stridpers idpers

tostring idhous`j', gen(stridhouse)
drop idhous`j'
rename stridhouse idhouse


isvar wstat`j' sex`j' educat`j' civsta`j' age`j' p`j'w96 p`j'w95 p`j'w86a idpers p`j'w11 p`j'w101 p`j'w100 p`j'l101 p`j'i02 pdate`j' p`j'w94 p`j'w93 p`j'w92 p`j'w616 p`j'w615 p`j'w228 p`j'w229 p`j'w230 p`j'ql04 p`j'p45 p`j'p02 p`j'l100 p`j'i01 p`j'f04 p`j'f03 p`j'f02 p`j'f01  p`j'c02 p`j'c44 p`j'a06 p`j'a05 p`j'c50 p`j'p26 p`j'p18 p`j'p17 p`j'p16 p`j'p15 p`j'p14 p`j'p13 p`j'p12 p`j'p11 p`j'p10 p`j'p04 p`j'p03 p`j'p01 p`j'w01 p`j'w02  p`j'w03 p`j'n43 weip`j'tp wp`j't1p wp13tp wi`j'csp weip`j'ts wp`j't1s wp13ts wi`j'css nat_1_`j' p`j'r01 p`j'r04 p`j'e16

*create missing values for all variables not available in a given wave
foreach v in `r(badlist)' { 
  gen `v' = . 
  } 
if `j'==99{
gen shpwave=1
}
if `j'!=99{
gen shpwave= `j' + 2
}

keep wstat`j' sex`j' educat`j' civsta`j' age`j' p`j'w96 p`j'w95 p`j'w86a idhouse idpers p`j'w96 p`j'w95 p`j'w86a p`j'w11 p`j'w101 p`j'w100 p`j'l101 p`j'i02 pdate`j' p`j'w94 p`j'w93 p`j'w92 p`j'w616 p`j'w615 p`j'w228 p`j'w229 p`j'w230 p`j'ql04 p`j'p45 p`j'p02 p`j'l100 p`j'i01 p`j'f04 p`j'f03 p`j'f02 p`j'f01  p`j'c02 p`j'c44 p`j'a06 p`j'a05 p`j'c50 shpwave p`j'p26 p`j'p18 p`j'p17 p`j'p16 p`j'p15 p`j'p14 p`j'p13 p`j'p12 p`j'p11 p`j'p10 p`j'p04 p`j'p03 p`j'p01 p`j'w01 p`j'w02  p`j'w03 p`j'n43 wi`j'csp weip`j'tp wp`j't1p wi`j'csp wp13tp weip`j'ts wp`j't1s wp13ts wi`j'css nat_1_`j' p`j'r01 p`j'r04 p`j'e16


*assign missings to wpt1s/wpt1p weight for wave 13, as we only want the wh13ts/wh13tp weight which has less missings
if `j'==13{
replace wp`j't1p=.
replace wp`j't1s=.
}

*TOPIC: SUBJECTIVE EVALUATION
rename p`j'w96 	cmj_work_atmo
label var cmj_work_atmo "CMJ: Comparison: work atmosphere"
rename p`j'w95 	cmj_work_condi
label var cmj_work_condi "CMJ: Comparison: work conditions"
rename p`j'w86a cmj_job_secur
label var cmj_job_secur "CMJ: Job security: Estimation"
rename p`j'w11  chance_findjob
label var chance_findjob "Chance of finding the right job: Next 12 months"
rename p`j'w101 cmj_risk_unempl
label var cmj_risk_unempl "CMJ: Risk of unemployment: Next 12 months"
rename p`j'w100 cmj_job_quali
label var cmj_job_quali "CMJ: Qualifications for job"
rename p`j'l101 securityfeel
label var securityfeel "Feeling of security"
rename p`j'i02 satis_fin_change
label var satis_fin_change "Satisfaction with financial situation: Change"

*TOPIC: SATISFACTION
rename p`j'w94 cmj_satis_atmo
label var cmj_satis_atmo "CMJ: Satisfaction: Work atmosphere"
rename p`j'w93 cmj_satis_condi
label var cmj_satis_condi "CMJ: Satisfaction: Work conditions"
rename p`j'w92 cmj_satis_inc
label var cmj_satis_inc "CMJ: Satisfaction: Income"
rename p`j'w616 cmj_satis_promo
label var cmj_satis_promo "CMJ: Satisfaction: Promotion"
rename p`j'w615 cmj_satis_hierarch
label var cmj_satis_hierarch "CMJ: Satisfaction: hierarchical superiors"
rename p`j'w230 cmj_satis_amount
label var cmj_satis_amount "CMJ: Satisfaction: amount of work"
rename p`j'w229 cmj_satis_interest
label var cmj_satis_interest "CMJ: Satisfaction: interest in tasks"
rename p`j'w228 cmj_satis_general
label var cmj_satis_general "CMJ: Satisfaction: job in general"
rename p`j'ql04 satis_rela
label var satis_rela "Satisfaction with personal relationships"
rename p`j'p45 general_trust
label var general_trust "General trust in people"
rename p`j'p02 satis_demo
label var satis_demo "Overall satisfaction with democracy"
rename p`j'l100 satis_security
label var satis_security "Satisfaction with personal security"
rename  p`j'i01 satis_fin
label var satis_fin "Satisfaction with financial situation"
rename p`j'f04 satis_housework
label var satis_housework "Satisfaction with way housework is shared"
rename p`j'f03 satis_alone_together
label var satis_alone_together "Satisfaction with living alone or together with other HH-members"
rename p`j'f02 satis_together
label var satis_together "Satisfaction with living together"
rename p`j'f01 satis_alone
label var satis_alone "Satisfaction with living alone"
rename p`j'c44 satis_life
label var satis_life "Satisfaction with life in general"
rename  p`j'c02 satis_health
label var satis_health "Satisfaction with health status"
rename p`j'a06 satis_leisure 
label var satis_leisure "Satisfaction with leisure activities"
rename p`j'a05 satis_freetime
label var satis_freetime "Satisfaction with free time"

*TOPIC: QUALITY OF LIFE 
rename p`j'c50 emo_worry
label var emo_worry "Emotions: Worry: Frequency"

*TOPIC: POLITICS 

rename p`j'p26 trust_parties
label var trust_parties "Trust in political parties"

rename p`j'p18 opin_nuclear
label var opin_nuclear "Opinion on nuclear energy: Direction"

rename p`j'p17 opin_taxation
label var opin_taxation "Opinion on taxes on high income: Direction"

rename  p`j'p16 opin_enviro
label var opin_enviro "Opinion on environmental protection: Direction"

rename p`j'p15 opin_foreign
label var opin_foreign "Opinion on chances for foreigners: Direction"

rename p`j'p14 opin_eu
label var opin_eu "Opinion on joining the EU: Direction"

rename p`j'p13 opin_socialexp
label var opin_socialexp "Opinion on social expenses: Direction"

rename p`j'p12 opin_army
label var opin_army "Opinion on Swiss army: Direction"

rename  p`j'p11 partyaffiliation
label var partyaffiliation "Member of a political party: Which"

rename  p`j'p10 leftright
label var leftright "Political position: Left, right"

rename  p`j'p04 trust_gov
label var trust_gov "Trust in Federal Government"

rename  p`j'p03 polit_influ
label var polit_influ "Feeling about political influence"

rename  p`j'p01 polit_interest
label var polit_interest "Interest in politics"

*TOPIC: DEMOGRAPHICS
rename age`j' age
label var age "Age in year of interview"

rename p`j'r01 pr01
rename p`j'r04 pr04
rename p`j'e16 pe16

rename civsta`j' civsta
label var civsta "Civil status in year of interview"
label define civsta -8 "other error" -3 "inapplicable" -2 "no answer" -1 "does not know" 1 "single, never married" 2 "married" 3 "separated" 4 "divorced" 5 "widower/widow" 6 "registered partnership" 7 "dissolved partnership", replace
label values civsta civsta

rename  educat`j' educat
label var educat "Highest level of education achieved"

rename sex`j' gender
label var gender "gender"

rename wstat`j' wstat
label var wstat "Working status"

*FILTER VARIABLES

rename p`j'w01 paidwork_employment
rename p`j'w02 nonpaidwork_familybusiness
rename p`j'w03 employed_nowork
rename p`j'n43 association_political_party

*WEIGHTS
*population weights
rename weip`j'tp weipxxtp
rename wp`j't1p wpxxt1p
rename wi`j'csp wixxcsp


*sample weights
rename weip`j'ts weipxxts
rename wp`j't1s wpxxt1s
rename wi`j'css wixxcss


gen weight_i_pop=max(weipxxtp ,wpxxt1p,wp13tp,wixxcsp)
replace weight_i_pop = . 	if weight_i_pop<0
label var weight_i_pop "Weights expanded to the resident Swiss population of current year (SHP_I_II_III)"

*sample weights
gen weight_i_sample=max(weipxxts, wpxxt1s, wp13ts, wixxcss)
replace weight_i_sample = . 	if weight_i_sample<0
label var weight_i_sample "Weights expanded to sample size (SHP_I_II_III)"

*VARIABLES FOR GRAPH REPLICATION
rename nat_1_`j' nation
*CREATE YEAR VARIABLE
rename pdate`j' intdate
gen year = year(intdate)

*GET RID OF MISSING YEARS
if `j'==99{
replace year =1999 if year==.
}
 else {
replace year = 2000 + `j' if year==.
}

save $wd/workingfiles/individual/tempp`j', replace
}

*---------------------------------------------------------------------------------------------

* CREATION OF DATASETS USING SHP-INDIVIDUAL-FILES ON SOCIAL ORIGIN 

use $wd/data/shp_so, clear
tostring idpers, gen(stridpers)
drop idpers
rename stridpers idpers
rename p__o73 work_compare_mother
label var work_compare_mother "Work situation: comparison with mother"
rename p__o72 work_compare_father
label var work_compare_father "Work situation: comparison with father"
decode osyy, gen(year)
destring year, replace
gen shpwave=osyy
keep shpwave year idpers work_compare_father work_compare_mother
save $wd/workingfiles/final/shp_so_temp, replace
*---------------------------------------------------------------------------------------------

* CREATION OF DATASETS USING SHP-INDIVIDUAL-FILES ON LAST JOB
use $wd/data/shp_lj, clear
tostring idpers, gen(stridpers)
drop idpers
rename stridpers idpers
rename p__w144a lj_job_secur_a
label var lj_job_secur_a "Last Job: Security of work (as of w6)"
rename p__w144  lj_job_secur
label var lj_job_secur "Last Job: Security of work"
decode ljyy, gen(year)
destring year, replace
gen shpwave=ljyy
keep shpwave year idpers lj_job_secur_a lj_job_secur
save $wd/workingfiles/final/shp_lj_temp, replace

*---------------------------------------------------------------------------------------------
* TRANSFORMATION OF COMMUNENR AND BFSNR TO STRINGS TO PREVENT MERGE ERRORS

foreach j in 99 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 {
use $wd/community_numbers_99_17/stata/communes`j', clear
tostring idhouse, gen(stridhouse)
drop idhouse
rename stridhouse idhouse
save $wd/data/communes`j'_clean, replace
}
*---------------------------------------------------------------------------------------------
/* Lay variables are only being collected as of w21
rename p`j'p97 lay_progress
label var lay_progress "Lay explanations for poverty: part of progress"

rename p`j'p96 lay_injustice
label var lay_injustice "Lay explanations for poverty: injustice"

rename p`j'p95 lay_laziness
label var lay_laziness "Lay explanations for poverty: laziness"

rename p`j'p94 lay_unlucky
label var lay_unlucky "Lay explanations for poverty: unlucky"

*/
*********************************
**** File 03 -  DATA APPEND *****
*********************************
*********************************

*HOUSEHOLD FILES
use $wd/workingfiles/household/temph99, clear

foreach j in 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 {
    append using $wd/workingfiles/household/temph`j'
}

save $wd/workingfiles/final/shp_hh_all, replace

*INDIVIDUAL FILES

use $wd/workingfiles/individual/tempp99, clear
foreach j in 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 {
    append using $wd/workingfiles/individual/tempp`j'
}

save $wd/workingfiles/final/shp_p_all, replace

*COMMUNE NUMBER FILES
use $wd/data/communes99_clean, clear
foreach j in 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 {
    append using $wd/data/communes`j'_clean
}

save $wd/workingfiles/final/communes_all, replace

*-----------------------------------------------------------------------------------------

****************************************
**** File 04 - DATA MERGE **************
****************************************
****************************************


*MERGE INDIVIDUAL FILES TO SHP_SO AND SHP_LJ FILES
use $wd/workingfiles/final/shp_p_all, clear

merge m:1 idpers year using $wd/workingfiles/final/shp_lj_temp
drop if _merge==2
drop _merge 
merge m:1 idpers year using $wd/workingfiles/final/shp_so_temp
drop if _merge==2
drop _merge
save $wd/workingfiles/final/shp_p_lj_so, replace


*MERGE INDIVIDUAL FILES TO HOUSEHOLD FILES

use $wd/workingfiles/final/shp_p_lj_so, clear
merge m:1 idhouse shpwave using $wd/workingfiles/final/shp_hh_all
drop _merge
save $wd/workingfiles/final/shp_combined_all, replace

*MERGE BFS-COMMUNITY NUMBERS TO SHP DATA
use $wd/workingfiles/final/communes_all, clear
merge 1:m idhouse shpwave using $wd/workingfiles/final/shp_combined_all
*household-id's 33481, 70691 and 72122 are missing in wave4's community file (communes02) (_merge==2)
keep if _merge==3
drop _merge
save $wd/workingfiles/final/shp_panel_1999_2017, replace
*-----------------------------------------------------------------------------------------
**************************************************
**** File 05 - BFSNR 2012 CROSSWALK **************
**************************************************
**************************************************
clear all
set more off


use $wd/workingfiles/final/shp_panel_1999_2017, clear
merge m:1 bfsnr using $wd/data/steinhauer_bfsnr_munnr2012
/*
    Result                           # of obs.
    -----------------------------------------
    not matched                         3,563
        from master                     2,354  (_merge==1)
        from using                      1,209  (_merge==2)

    matched                           237,705  (_merge==3)
    -----------------------------------------
*/

*some bfsnrs could not be matched with a munnr2012, i will hence export these cases and look up munnr2012 by hand:

keep  if _merge==1
keep munnr2012 bfsnr
duplicates drop bfsnr, force
export excel using $wd/data/shp_unmatched_bfsnr_temp.xlsx, firstrow(variables) nolabel replace

*after having identified the missing community numbers by hand, I reload the bfsnr/munnr2012 file...
import excel $wd/data/shp_unmatched_bfsnr.xlsx, sheet("Sheet1") firstrow clear
*...and convert it into a .dta file:
save $wd/data/shp_unmatched_bfsnr.dta, replace


*in a next step, i append the new bfsnrs to the longfile
use $wd/data/steinhauer_history2012_bfsnr2012_longfile2, clear
keep munnr2012 bfsnr 
save $wd/data/steinhauer_bfsnr_munnr2012, replace

append using $wd/data/shp_unmatched_bfsnr.dta

save $wd/data/bfsnr_munnr2012_complete, replace

*and finally merge the new complete variable munnr2012 to our final panel dataset:
use $wd/workingfiles/final/shp_panel_1999_2017, clear

merge m:1 bfsnr using $wd/data/bfsnr_munnr2012_complete
keep if _merge==3 | _merge==1
drop _merge 

label var munnr2012 "bfsnr 2012"
label var bfsnr "bfsnr in respective year"

/*
    Result                           # of obs.
    -----------------------------------------
    not matched                         1,224
        from master                        15  (_merge==1)
        from using                      1,209  (_merge==2)

    matched                           240,044  (_merge==3)
    -----------------------------------------
	
	15 cases could not be matched due to missing or -2 bfsnr --> drop
	_merge==2 are communes which we do not have in our dataset --> drop
*/
*-----------------------------------------------------------------------------------------

 *ORDER VARIABLES ACCORDING TO DOCUMENTATION

order 	idhouse idpers  ///
		weight_i_pop weight_i_sample weight_h_pop weight_h_sample ///
		year shpwave intdate ///
		bfsnr munnr2012 ///
		/*filter variables */ ///
		acco_tenant_owner association_political_party paidwork_employment  ///
		nonpaidwork_familybusiness employed_nowork ///
		/* outcomes */ ///
		gender age civsta educat wstat paidwork_employment nonpaidwork_familybusiness employed_nowork hhinc_net housingexp satis_hhfin finsit livingstandard cmj_work_atmo cmj_work_condi cmj_job_secur ///
		cmj_risk_unempl cmj_satis_atmo cmj_satis_condi cmj_satis_promo cmj_satis_hierarch cmj_satis_amount ///
		cmj_satis_interest cmj_satis_general cmj_satis_inc satis_fin satis_fin_change satis_rela  ///
		satis_housework satis_alone_together satis_together satis_alone satis_life satis_health satis_leisure ///
		satis_freetime polit_interest satis_demo general_trust polit_influ trust_gov opin_nuclear opin_taxation /// 
		opin_foreign opin_enviro opin_eu opin_socialexp opin_army partyaffiliation leftright 


drop wpxxt1p wp13tp wixxcsp wpxxt1s wp13ts wixxcss weihxxtp weihxxts whxxt1p whxxt1s whxxcsp whxxcss wh13tp wh13ts 

save $wd/workingfiles/final/shp_panel_1999_2017, replace


****************************************
**** File 06 - VARIABLE SELECTION ******
****************************************
****************************************


cd $wd
global opin opin_nuclear opin_taxation opin_foreign opin_enviro opin_eu opin_socialexp opin_army
*-----------------------------------------------------------------------------------------
*LADNER 2014 - WEN WÜRDEN SIE WÄHLEN? FIGUR 3, P.8

use $wd/workingfiles/final/shp_panel_1999_2017, clear
*POLITISCHE VERORTUNG	
preserve
*recode var nation to swiss/foreign
fre nation
gen swiss=1 if nation==8100
replace swiss=0 if nation <0 | nation !=8100
replace leftright=. if leftright <0
keep if year==1999 |year==2003 | year==2007|year==2011
bysort year swiss : sum leftright
collapse(mean)leftright, by(swiss year)
twoway (line leftright year if swiss==0) ///
	   (line leftright year if swiss==1) ///
	   , legend(order(1 "Ausländer" 2 "Schweizer" )) ///s
	   xtitle("Jahr") ///
	   title("Politische Verortung") ///
	   graphregion(color(white))
	 graph export $replica/ladner_figur3_shp.pdf, as(pdf) replace
	 
* we have slightly different swiss/foreign ratios, might as well be due to different sample selection though. I could unfortunately not find a more detailed description of this
restore

*-----------------------------------------------------------------------------------------
*LADNER 2014 - WEN WÜRDEN SIE WÄHLEN? FIGUR 2, P.7

*POLITISCHES INTERESSE
use $wd/workingfiles/final/shp_panel_1999_2017, clear

preserve
*recode var nation to swiss/foreign
fre nation
gen swiss=1 if nation==8100
replace swiss=0 if nation <0 | nation !=8100
replace polit_interest=. if polit_interest <0
keep if year==1999 |year==2003 | year==2007|year==2011
bysort year swiss : sum polit_interest
collapse(mean)polit_interest, by(swiss year)
twoway (line polit_interest year if swiss==0) ///
	   (line polit_interest year if swiss==1) ///
	   , legend(order(1 "Ausländer" 2 "Schweizer" )) ///s
	   xtitle("Jahr") ///
	   yscale(r(0 10)) ylabel(0(1)10) ///
	   title("Politisches Interesse") ///
	   graphregion(color(white))
	 graph export $replica/ladner_figur1_shp.pdf, as(pdf) replace


* we have slightly different swiss/foreign ratios, might as well be due to different sample selection though. I could unfortunately not find a more detailed description of this. i.e. Ladner has a foreign /swiss ratio of 688/6630 swiss in 2011. we count 689/6628 or Ladner 1999: 889/6889 vs us: 890/6889
restore

*-----------------------------------------------------------------------------------------
